#ifndef H_SERVER_H
#define H_SERVER_H

#include <set>

#include "sessionmanager.h"

namespace QinChat{
    namespace Net{

        class CSession;


        class CServer{
            public:
                explicit CServer();
                ~CServer(void);

            public:
                bool Init();
                void Run(void);
                void Exit(void);

            protected:
                std::shared_ptr<CSession> Accepte(void);
                void Close(int clientFd);
                void handleDown(std::vector<int>& downVector);

            private:
                int m_serverfd = -1;
                std::set<int> m_setClientFd;
                CSessionManager m_sessionManager;
        };
    }
}

#endif // ! H_SERVER_H